<div class="head">
	<h2><?php __d('lilcart', 'Category list');?></h2>
	<div class="actions">[+] <?php echo $html->link(__d('lilcart', 'Add Category', true), array('action'=>'add')); ?></div>
</div>
<div class="index" id="CategoryIndexTable">
<table cellpadding="0" cellspacing="0">
	<thead>
		<tr>
			<th class="minwidth">&nbsp;</th>
			<th class="left"><?php __d('lilcart', 'Title');?></th>
			<?php
				// new th for every language if available
				if ($p_lngs = (array)Configure::read('LilcartPlugin.languages')) {
					foreach ($p_lngs as $p_lng) {
						echo '<th class="center">';
						if ($flag_prefix = Configure::read('LilcartPlugin.l18nFlagUrl')) {
							echo $html->image($flag_prefix.$p_lng.'.png', array('style'=>'height:32px'));
						} else {
							echo $sanitize->html($p_lng);
						}
						echo '</th>';
					}
				} else {
					echo '<th class="actions">&nbsp;</th>';
				}
			?>
			<th class="actions">&nbsp;</th>
			<th class="actions">&nbsp;</th>
			<th class="actions">&nbsp;</th>
		</tr>
	</thead>
<?php
$i = 0;
foreach ($data as $key => $item) {
?>
	<tr<?php if ($i++ % 2 == 0) echo ' class="altrow"';?>>
		<td><?php echo $html->image($lilcart->categoryImageUrl($key), array('style'=>'width: 64px;')); ?></td>
		<td <?php echo 'style="padding-left: '.(5+(strlen($item)-strlen(trim($item, '_')))*20).'px;"'; if(trim($item, '_')==$item) echo ' class="big"';; ?>><?php echo trim($item, '_'); ?></td>
		
		<?php
			if (!empty($p_lngs)) {
				foreach ($p_lngs as $p_lng) {
					echo '<td class="center">';
					echo $html->link(__d('lilcart', 'Edit', true), array('action'=>'edit', $key, 'lang'=>$p_lng));
					echo '</td>';
				}
			} else {
		?>
			<td class="actions center"><?php echo $html->link(__d('lilcart', 'Edit', true), array('action'=>'edit', $key)); ?></td>
		<?php
			}
		?>
		<td class="actions center"><?php echo $html->link(__d('lilcart', 'Delete', true), array('action'=>'delete', $key), null, sprintf(__d('lilcart', 'Are you sure you want to delete # %s?', true), $key)); ?></td>
		<td class="actions center"><?php echo $html->link(__d('lilcart', 'Up', true), array('action'=>'up', $key), null, sprintf(__d('lilcart', 'Are you sure you want to move up # %s?', true), $key)); ?></td>
		<td class="actions center"><?php echo $html->link(__d('lilcart', 'Down', true), array('action'=>'down', $key), null, sprintf(__d('lilcart', 'Are you sure you want to move down # %s?', true), $key)); ?></td>
	</tr>
<?php } ?>
</table>
</div>